package com.huaxin.hxenum.typehandler;

import com.huaxin.hxenum.base.BaseCodeEnumTypeHandler;
import com.huaxin.hxenum.enums.DeviceType;
import org.apache.ibatis.type.JdbcType;
import org.apache.ibatis.type.MappedTypes;

import java.sql.PreparedStatement;
import java.sql.SQLException;

@MappedTypes(DeviceType.class)
public class DeviceTypeHandler extends BaseCodeEnumTypeHandler<DeviceType, String> {
    public DeviceTypeHandler() {
        super(DeviceType.class);
    }

    @Override
    public void setNonNullParameter(PreparedStatement ps, int i, DeviceType parameter, JdbcType jdbcType) throws SQLException {
        ps.setString(i, parameter.getCode());
    }
}
